package com.geeguo.ebuilder.operation.base.security.utils;

import com.geeguo.ebuilder.core.security.utils.AuthHelper;
import com.geeguo.ebuilder.operation.base.security.model.LoginUser;

/**
 * 权限工具类
 */
public class AuthUtils {

	public static final AuthHelper<LoginUser> authHelper = new AuthHelper<>(LoginUser.class);

	/**
	 * 创建令牌并缓存
	 */
	public static void createToken(LoginUser loginUser) {
		authHelper.createToken(loginUser);
	}

	/**
	 * 获取当前用户登录信息
	 */
	public static LoginUser getLoginUser() {
		return authHelper.getLoginUser();
	}

	/**
	 * 获取当前用户登录信息
	 */
	public static LoginUser getLoginUser(String token) {
		return authHelper.getLoginUser(token);
	}

	/**
	 * 会话注销
	 */
	public static void logout() {
		authHelper.logout();
	}

	/**
	 * 会话注销
	 */
	public static void logout(String token) {
		authHelper.logout(token);
	}

	/**
	 * 验证当前用户登录有效期
	 */
	public static void verifyExpireTime(LoginUser loginUser) {
		authHelper.verifyExpireTime(loginUser);
	}
}